from .songs import Song
from .singer import Singer
from .album import Album
from db import db, BaseFul


class Relation(BaseFul):
    singer_id = db.Column(db.ForeignKey(Singer.id, ondelete='set null'))
    song_id = db.Column(db.ForeignKey(Singer.id, ondelete='set null'))
    album_id = db.Column(db.ForeignKey(Singer.id, ondelete='set null'))
    singer = db.relationship(Singer, primaryjoin='Relation.singer_id==Singer.id', backref='relation')
    song = db.relationship(Song, primaryjoin='Relation.song_id==Song.id', backref='relation')
    album = db.relationship(Album, primaryjoin='Relation.album_id==Album.id', backref='relation')
